<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        div{
            width: 100px;
            height: 100px;
            background: rgb(42, 224, 233);
            position: absolute;
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>
<script> 
    function move(dom,type){
        Object.entries(type)
        .forEach(([mode,moveDistance]) => {
            let step = 0;
            const timeId = setInterval(() => {
                step+=moveDistance?.materStep??3;
                if(step >= (moveDistance?.materDistance??moveDistance)){
                    clearInterval(timeId);
                }
                dom.style[mode] = step + (moveDistance?.company??"px");
            }, 1000/60);
        })
    }
    const box = document.querySelector("div");
    box.addEventListener("click",()=>{
        move(box,{
            top:{
                materDistance:200,
                materStep:5
            },
            left:{
                materDistance:200,
                materStep:6
            },
            "border-radius":{
                company:"%",
                materStep:1,
                // materDistance:200
            }

        });
    })
    
    
</script>